home *** CD-ROM | disk | FTP | other *** search
/ Merciful 2 / Merciful - Disc 2.iso / software / a / amitcpv4.1cracked1.dms / amitcpv4.1cracked1.adf / Install_AmiTCP < prev    next >
Text File  |  1994-12-23  |  45KB  |  1,376 lines

  1. ;;;; Hey Emacs, this script might as well be -*- lisp -*-
  2. ;;;;
  3. ;;;; Install_AmiTCP - AmiTCP/IP installation script for Installer
  4. ;;;;
  5. ;;;; Copyright © 1994 AmiTCP/IP Group,
  6. ;;;;                  NSDi - Network Solutions Development Inc., Finland
  7. ;;;;                  All rights reserved.
  8. ;;;;
  9. ;;;; $Id: Install_AmiTCP,v 4.22 1994/12/23 08:20:32 jraja Exp $
  10. ;;;;
  11. ;;;; This script has been tested with Installer 1.24:
  12. ;;;;
  13. ;;;;     Installer and Installer project icon
  14. ;;;;     (c) Copyright 1991-93 Commodore-Amiga, Inc.  All Rights Reserved.
  15. ;;;;     Reproduced and distributed under license from Commodore.
  16. ;;;;
  17. ;;;;     INSTALLER SOFTWARE IS PROVIDED "AS-IS" AND SUBJECT TO CHANGE;
  18. ;;;;     NO WARRANTIES ARE MADE.  ALL USE IS AT YOUR OWN RISK.  NO LIABILITY
  19. ;;;;     OR RESPONSIBILITY IS ASSUMED.
  20. ;;;;
  21. ;;;; Use following Icon tooltypes / Command line options:
  22. ;;;; APPNAME=AmiTCP/IP
  23. ;;;; MINUSER=AVERAGE
  24. ;;;;
  25. (welcome "    Welcome to the " @app-name " 4.1 installation.\n")
  26. ;;;;
  27. ;;;; What we are?
  28. ;;;;
  29. (set app-name (cat @app-name " 4.1"))
  30.  
  31. ;;;;
  32. ;;;; "Needs"
  33. ;;;;
  34. (set need-version 37  ; version of operating system need by AmiTCP/IP
  35.      need-memory (* 512 1024)
  36.  
  37.      AmiTCP-release-number 4 ; this release
  38.      )
  39. (set 
  40. ;;;
  41. ;;; Installation disk names
  42. ;;;
  43.  install-disk1-name "AmiTCP-41_Install#1:"
  44.  install-disk2-name "AmiTCP-41_Install#2:"
  45. ;;;
  46. ;;; Used pkt-files, source-dir will remain on the disk from which the 
  47. ;;; installer was started!
  48. ;;;
  49.  AmiTCP-pkt-file (tackon install-disk1-name "AmiTCP.pkt")
  50.  Docs-pkt-file (tackon install-disk2-name "AmiTCPdocs.pkt")
  51.  GNUEmacs-pkt-file (tackon install-disk2-name "GNUEmacs.pkt")
  52.  NapsaFonts-pkt-file (tackon install-disk2-name "NapsaFonts.pkt")
  53.  SDK-pkt-file (tackon install-disk2-name "AmiTCP-sdk-41.pkt")
  54. ;;;
  55. ;;; Other sources on installation disks
  56. ;;;
  57.  dist-networks-dir (tackon install-disk2-name "Devs/Networks")
  58.  Installer-file (tackon install-disk1-name "bin/Installer")
  59.  UnPkt-file (tackon install-disk1-name "UnPkt")
  60.  LICENSE-file (tackon install-disk1-name "LICENSE")
  61.  README-FIRST-file (tackon install-disk1-name "README.FIRST")
  62.  GNUEmacs-readme-file (tackon install-disk2-name "GNUEmacs.readme")
  63.  SDK-readme-file (tackon install-disk2-name "AmiTCP-sdk-41.readme")
  64.  
  65. ;;;
  66. ;;; Destination directories of the AmiTCP/IP
  67. ;;;
  68.  atcp-name "AmiTCP"
  69.  atcp-assign (cat atcp-name ":")    ; Assign to AmiTCP
  70.  ;; Configuration
  71.  conf-dir (tackon atcp-assign "db")
  72.  ;; User binaries
  73.  bin-dir (tackon atcp-assign "bin")
  74.  ;; documentation
  75.  doc-dir (tackon atcp-assign "doc")
  76.  ;; devices directory
  77.  devs-dir (tackon atcp-assign "devs")
  78.  ;; AmigaGuide documentation
  79.  help-dir (tackon atcp-assign "help")
  80.  ;; DOS handlers
  81.  l-dir (tackon atcp-assign "l")
  82.  ;; libraries
  83.  libs-dir (tackon atcp-assign "libs")
  84.  ;; daemons
  85.  serv-dir (tackon atcp-assign "serv")
  86.  ;; source
  87.  src-dir (tackon atcp-assign "src")
  88.  ;; includes for net applications
  89.  include-dir (tackon atcp-assign "netinclude")
  90.  ;; network link libraries
  91.  lib-dir (tackon atcp-assign "netlib")
  92.  ;;
  93.  ;; The source directory name
  94.  source-dir (if (= 1 (exists @icon))
  95.             (pathonly (expandpath @icon))
  96.           (expandpath @icon))
  97.  ;; Mounts
  98.  apipe-mount (cat 
  99.           "Assign APIPE: Exists > NIL:\n" 
  100.           "IF Warn\n"
  101.           "  Mount APIPE: from AmiTCP:devs/APipe-Mountlist\n"
  102.           "EndIf\n")
  103.  )
  104.  ;; How to get needed information?
  105. (set
  106.  net-setup-help
  107.      "    You can get this information from your network administration.\n")
  108.  
  109. ;;; copy "more" to ram: to be able to use it
  110. (set
  111. ; pager-cmd (if (exists "ENV:PAGER" (noreq)) (getenv "PAGER"))
  112.  pager-cmd 
  113. ; (if pager-cmd pager-cmd 
  114.  (if (exists "SYS:Utilities/More" (noreq))
  115.      ((copyfiles
  116.        (prompt "Copying sys:utilities/more to ram: for use")
  117.        (source "SYS:Utilities/More")
  118.        (dest   "RAM:")
  119.        (safe)
  120.        (optional "nofail"))
  121.       "RAM:More")
  122.    ("more"))
  123. ; )
  124.  )
  125.  
  126. ;; Return old AmiTCP: assign if we are aborting
  127. (onerror
  128.  (if old-atcp-directory
  129.      (makeassign atcp-name old-atcp-directory)))
  130.  
  131. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  132. (procedure
  133.  check-system-version
  134.  ;; is your Exec recent enough?
  135.  (set exec-version (/ (getversion) 65536))
  136.  (transcript "Running on exec version " exec-version ".")
  137.  (if (< exec-version need-version)    ; check operating system version
  138.      ((message "The " @app-name " needs at least Exec version " need-version
  139.            " to run.\nYou have only version " exec-version ".\n"
  140.            "You can proceed with the installation, but consider "
  141.            "installing the " @app-name " with proper version of "
  142.            "the operating system."
  143.            (help
  144.         "    The " @app-name " uses some system functions "
  145.         "that are not present or functional in earlier system "
  146.         "versions. Consider updating your system.\n"
  147.         "    If you have a later version of operating system "
  148.         "and are only now using older version: be sure to use "
  149.         "only release 2.04 or newer with the " @app-name ". "
  150.         "No damage happens if you run the " @app-name " with an "
  151.         "earlier operating system, however. It just "
  152.         "refuses to start.\n"
  153.         "    If you decide to continue, no changes will be made to "
  154.         "system startup files, so you must edit them yourself. "
  155.         "Refer instructions for manual installation."))
  156.       (transcript "User decided to continue installation while running "
  157.           "on operating system release earlier than 2.04."))))
  158.  
  159.  
  160. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  161. (procedure
  162.  check-available-memory
  163.  ;;
  164.  (transcript "Checking available memory.")
  165.  (set avail-mem (+ (database "total-mem")))
  166.  (if (< avail-mem need-memory)
  167.      ((message "Your system has only " (/ avail-mem 1024) " kilobytes of "
  168.            "free memory, while the " @app-name " needs at least "
  169.            (/ need-memory 1024) " to be useful.\n"
  170.            "You can continue the installation but be warned!")
  171.       (transcript "User decided to continue installation while available "
  172.           "memory was below the recommended minimum."))))
  173.  
  174. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  175. (procedure
  176.  check-user-level
  177.  ;;
  178.  (transcript "Checking user level.")
  179.  (if (< @user-level 1)
  180.      ((transcript "Installation aborted due to too low user level.")
  181.       (abort "AmiTCP/IP installation requires at least the \"average\" "
  182.          "user level. Restart installation and select appropriate user "
  183.          "level."))))
  184.  
  185. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  186. (procedure
  187.  check-old-assign
  188.  ;; If there is already the AmiTCP/IP installed, store the assign
  189.  ;; to old-atcp-directory
  190.  (transcript "Checking for already installed AmiTCP.")
  191.  (set old-atcp-directory 
  192.       (if (exists atcp-assign (noreq))
  193.       (getassign atcp-name)
  194.     ""))
  195.  (if old-atcp-directory
  196.      (transcript "Existing AmiTCP detected at directory " 
  197.          old-atcp-directory ".")))
  198.  
  199. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  200.  
  201. ; Simple database "emulator" for testing purposes 
  202. (procedure
  203.  database-test "68000")
  204.  
  205. (procedure
  206.  check-cpu-type
  207.  (set cpu-type (database "cpu"))
  208. ; (set cpu-type (database-test))
  209.  (set cpu-is-020-or-better
  210.       (AND (<> cpu-type "68000")
  211.        (<> cpu-type "68010")))
  212.  )
  213. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  214. (procedure
  215.  ask-accept-license ;; Ask if the user accepts license conditions
  216.  (transcript "Asking if the user accepts the license conditions.")
  217. ;;
  218. ;; use "more" to show the full license text
  219. ;;
  220.  (run (cat "run " pager-cmd) LICENSE-file (safe))
  221.  (message "\nAmiTCP/IP is a copyrighted propiertary software of "
  222.       "the Network Solutions Development Inc.\n"
  223.           "\nPlease read the shown license text carefully.\n"
  224.           "\nBy proceeding the installation of this software you "
  225.       "indicate that you accept the license conditions.\n\n"
  226.       "Also note that you should fill in your registration card "
  227.       "and send the filled card to NSDi using the included "
  228.       "return-envelope.\n"
  229.       )
  230.  )
  231.  
  232. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  233. (procedure
  234.  select-destination-directory
  235.  ;; Select destination directory for the installation.
  236.  ;; This is the floppy install-version
  237.  ;;
  238.  (transcript "Selecting destination directory for the installation.")
  239.  (while
  240.      ((set @default-dest
  241.        (askdir
  242.         (prompt "Select directory where to install the " app-name ".")
  243.         (help "    Here you can specify location where to install "
  244.           "the " app-name ".\n"
  245.           "    Installation must NOT be made on top of an older "
  246.           "version of the " @app-name ".")
  247.         (newpath)
  248.         (default (cat (getdevice "SYS:") ":"))
  249.         ))
  250.       (if (= 2 (exists @default-dest))
  251.       ;; check that installation is not tried over an old version
  252.       (if (OR (exists (tackon @default-dest "bin/AmiTCP")) ; version 1.0
  253.           (> AmiTCP-release-number
  254.              (if (exists (tackon @default-dest "AmiTCP"))
  255.              (getversion (tackon @default-dest "AmiTCP"))
  256.                $7FFFFFFF)))
  257.           ((message "You are possibly trying to install the " @app-name " "
  258.             "over an old version of it.\n"
  259.             "It is not allowed.\n"
  260.             "You should select some other directory or abort "
  261.             "the installation.")
  262.            1)
  263.         0)
  264.     ((makedir @default-dest
  265.          (infos))
  266.      0))))
  267.  
  268.  ;; Make the AmiTCP: assign
  269.  (makeassign atcp-name @default-dest)
  270.  (if (NOT (= 2 (exists (tackon atcp-assign "devs"))))
  271.      (makedir (tackon atcp-assign "devs")))
  272. )
  273.  
  274. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  275. ;;
  276. ;; This is floppy-install version
  277. ;;
  278. ;; arguments:
  279. ;;
  280. ;;   unpkt-source      - the source archive
  281. ;;   unpkt-destination - the destination directory
  282. ;;   unpkt-sdp         - number of directories to strip
  283. ;;   unpkt-title-name  - descriptative name of the archive
  284. ;;   unpkt-title-not   - installation unit name
  285.  
  286. (procedure
  287.  run-unpkt 
  288.  ;;
  289.  (if (exists unpkt-source)
  290.      ((transcript "Dearchiving " unpkt-source " files to " unpkt-destination ".")
  291.       (working "Writing files to " unpkt-destination "...")
  292.       (if (run (cat unpkt-cmd " "
  293.             "\"" unpkt-source "\" "
  294.             "\"" unpkt-destination "\""
  295.             " SDP=" unpkt-sdp 
  296.             " >\"CON:10/10/600/100/UnPkt Output/INACTIVE/AUTO\" "))
  297.       (abort "    UnPkt could not dearchive the " unpkt-source ". "
  298.          "This may be due to:\n"
  299.          "    1) Not enough disk space\n"
  300.          "    2) Not enough memory\n"
  301.          "    3) Corrupted archive\n"
  302.          "    4) Corrupted UnPkt\n"))
  303.       1)
  304.    ((transcript unpkt-source " could not be located, and is NOT installed!")
  305.     (message "\nWARNING\n\n"
  306.          "Could not locate the " unpkt-title-name " archive.\n"
  307.          unpkt-title-not " is NOT installed!")
  308.     0))
  309.  )
  310.  
  311.  
  312. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  313. ;;
  314. ;; This is floppy-install version
  315. ;;
  316. (procedure
  317.  copy-files-to-destination ;;; UnPkt AmiTCP/IP files to the destination
  318.  ;;
  319.  
  320.  (set 
  321.   unpkt-source AmiTCP-pkt-file
  322.   unpkt-destination @default-dest
  323.   unpkt-sdp 1
  324.   unpkt-title-name "AmiTCP/IP program"
  325.   unpkt-title-not "AmiTCP/IP"
  326.   )
  327.  (if (run-unpkt)
  328.      (
  329.       ;;
  330.       ;; Copy the Installer
  331.       ;;
  332.       (copyfiles
  333.        (source Installer-file)
  334.        (dest bin-dir)
  335.        (files)
  336.        (infos))
  337.  
  338.       ;;
  339.       ;; Create AmiTCP:log if it does not exist already
  340.       ;;
  341.       (if (NOT (= 2 (exists (tackon atcp-assign "log"))))
  342.       (makedir (tackon atcp-assign "log")))
  343.       ;;
  344.       ;; Create AmiTCP:log/wtmp if it does not exist already
  345.       ;; (This is to avoid unnecessary errors from the ftpd)
  346.       ;;
  347.       (if (NOT (= 1 (exists (tackon atcp-assign "log/wtmp"))))
  348.       (textfile (dest (tackon atcp-assign "log/wtmp"))))
  349.       ;;
  350.       ;; Add script flags to the scripts, pure flags to pure programs
  351.       ;;
  352. ; (protect (tackon bin-dir "ch_nfsctl") "+s +e")
  353. ; (protect (tackon bin-dir "netstat") "+s +e")
  354. ; (protect (tackon bin-dir "SynClock") "+s +e")
  355. ; (protect (tackon bin-dir "stopnet") "+s +e")
  356. ; (if (exists src-dir)
  357. ;     ((protect (tackon src-dir "compile") "+s +e")
  358. ;      (protect (tackon src-dir "compile.lib") "+s +e")))
  359. ; (protect (tackon bin-dir "NapsaTerm") "+p +e")
  360. ; (protect (tackon serv-dir "in.fingerd") "+p +e")
  361. ; (if (exists (tackon bin-dir "rcsrev"))
  362. ;     (protect (tackon bin-dir "rcsrev") "+p +e"))
  363.  
  364.       (ask-use-020-binaries)
  365.  
  366.       ;; Install the docs...
  367.       (set
  368.        unpkt-source Docs-pkt-file
  369.        unpkt-destination @default-dest
  370.        unpkt-sdp 1
  371.        unpkt-title-name "AmiTCP/IP documentation"
  372.        unpkt-title-not "Documentation"
  373.        )
  374.       (if (run-unpkt)
  375.       (if (or (or (>= exec-version 39)
  376.               (exists "SYS:Utilities/multiview"))
  377.           (> @user-level 1))
  378.           (if (askbool
  379.            (prompt
  380.             "AmigaGuide utility is used to view the included "
  381.             "AmigaGuide documents in \"AmiTCP:help/\" directory.\n\n"
  382.             "Would you like to use MultiView instead?")
  383.            (help
  384.             "Installer has detected that your operating system should "
  385.             "include the MultiView utility, which you might want to "
  386.             "use instead of AmigaGuide utility to show the online "
  387.             "documentation."))
  388.           ((set multiview-path
  389.             (if (exists "SYS:Utilities/multiview")
  390.                 "SYS:Utilities/multiview"
  391.               (askfile
  392.                (prompt "Please show where the MultiView utility "
  393.                    "can be found:")
  394.                (help "The MultiView utility could not be located "
  395.                  "from it's normal location "
  396.                  "(\"SYS:Utilities/multiview\"), so you need "
  397.                  "to tell the location of the utility. Give "
  398.                  "an empty name to cancel the operation.\n")
  399.                (default "SYS:Utilities/")
  400.                ))
  401.             )
  402.            (if (= 1 (exists multiview-path))
  403.                (foreach 
  404.             help-dir "#?.info"
  405.             (tooltype
  406.              (dest
  407.               (tackon
  408.                help-dir 
  409.                (substr
  410.                 @each-name 0 (- (strlen @each-name) 5))))
  411.                 
  412.              (setdefaulttool multiview-path)))))
  413.         )))
  414.       ;; AmiTCP/IP program archive installed succesfully
  415.       1)
  416.     0))
  417.  
  418. (procedure
  419.  ask-use-020-binaries
  420.  (if cpu-is-020-or-better
  421.      (if (askbool
  422.       (prompt "Your CPU is of type " cpu-type ", thus the '020 "
  423.           "version of AmiTCP (AmiTCP.020) should be renamed to "
  424.           "\"AmiTCP\" (The '000 binary will be kept as "
  425.           "\"AmiTCP.000\").\n\nShall this be done?\n")
  426.       (help "You have an option to determine which AmiTCP binary "
  427.         "version should be used. The selection is left to you "
  428.         "for you to be able to switch to either of the binaries "
  429.         "if there happens to be problems with the other.")
  430.       )
  431.      ;; rename AmiTCP to AmiTCP.000 and AmiTCP.020 to AmiTCP
  432.      ((rename (tackon atcp-assign "AmiTCP")
  433.           (tackon atcp-assign "AmiTCP.000"))
  434.       (rename (tackon atcp-assign "AmiTCP.020")
  435.           (tackon atcp-assign "AmiTCP"))
  436.       )
  437.        )
  438.    ;; Delete the '020 binaries, if not '020 or higher
  439.    (if (askbool
  440.     (choices "Delete" "Do not delete")
  441.     (prompt "Your CPU is of type " cpu-type ", thus the '020 "
  442.         "version of AmiTCP could be deleted from your disk. "
  443.         "If you later upgrade your CPU, you should "
  444.         "re-install " @app-name ".\n")
  445.     (help "The '020 binary can be deleted to save your disk space."))
  446.        (delete (tackon atcp-assign "AmiTCP.020")
  447.            (optional "force")))
  448.    ))
  449.  
  450. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  451. (procedure
  452.  update-devices
  453.  (transcript "Updating Sana-II device drivers.")
  454.  ;;
  455.  ;; Create directory DEVS:Networks if it does not exist already
  456.  ;;
  457.  (if (NOT (= 2 (exists "DEVS:Networks")))
  458.      (makedir "DEVS:Networks"))
  459.  ;;
  460.  ;; Copy each driver in the distribution to the DEVS:Networks if necessary
  461.  ;;
  462.  (working "Checking Sana-II device drivers...")
  463.  (if (= 2 (exists dist-networks-dir))
  464.      (foreach
  465.        dist-networks-dir "#?.device"
  466.        ((set dist-name (tackon dist-networks-dir @each-name)
  467.          devs-name (tackon "DEVS:Networks" @each-name)
  468.          dist-version (getversion dist-name)
  469.          copy-it (NOT (exists devs-name)))
  470.     ;;
  471.     ;; Check if the driver should be copied over
  472.     ;;
  473.     (if (NOT copy-it)
  474.         (set copy-it
  475.                  ; or if the driver in DEVS:Networks is of older version
  476.          (< (set devs-version (getversion devs-name)) dist-version)))
  477.     (if (NOT copy-it)
  478.         (set copy-it
  479.              ; or if the files are of the same version but different
  480.          (set sum-differs (if (= dist-version devs-version)
  481.                       (<> (getsum dist-name)
  482.                       (getsum devs-name))
  483.                     0))))
  484.     (if copy-it
  485.         (copyfiles
  486.          (prompt "Should this Sana-II driver be installed in Devs:Networks?\n"
  487.              (if devs-version
  488.              (cat "A driver with the same name exists already"
  489.                   (if sum-differs
  490.                   (cat ", it has the same version, but the "
  491.                        "files are not the same.")
  492.                 (cat ", but the driver in the "
  493.                      "DEVS:Networks is of older version.")))
  494.                ""))
  495.          (help
  496.           "    The Sana-II drivers should be located in "
  497.           "the DEVS:Networks directory.\n"
  498.           "    This directory is the official location for the Sana-II "
  499.           "device drivers.")
  500.          (source (pathonly dist-name))
  501.          (choices (fileonly dist-name))
  502.          (dest "DEVS:Networks")
  503.          (files)
  504.          (optional "nofail" "askuser")
  505.          (confirm "average")))))
  506.    (message "No Sana-II drivers found on the installation disk")
  507.    )
  508.  )
  509.  
  510. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  511. (procedure
  512.  ask-update-devices
  513.  (if (= 2 (exists dist-networks-dir))
  514.      (if (askbool
  515.       (prompt "\nDo you want to update your Sana-II network device "
  516.           "drivers?\n"
  517.           "Each copy will be confirmed.")
  518.           (help
  519.            "    Each new AmiTCP/IP distribution usually contains "
  520.            "updated versions of some of the provided Sana-II network "
  521.            "device drivers. If you choose \"Yes\", this installation "
  522.            "script will check for each device, if this is the case."))
  523.          (update-devices)
  524.        (transcript "User did not want to update Sana-II drivers."))
  525.    (transcript "Directory " dist-networks-dir " not found.")))
  526.  
  527. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  528. ;; 
  529. ;; arguments:
  530. ;;
  531. ;; uus::commands - commands to add
  532. ;; uus::section  - section name
  533. ;; uus::file     - file name into which to save the changes if needed
  534. ;;
  535. (procedure
  536.  update-user-startup
  537.  (set uus::complete (cat ";BEGIN " uus::section "\n"
  538.              uus::commands
  539.              ";END " uus::section "\n"))
  540.  (if (askbool
  541.       (prompt "\nDo you want Installer to make the required changes to "
  542.           "your S:User-Startup script?\n"
  543.           "\n(There is a problem with Installer making these "
  544.           "changes if you do not have the original boot volume "
  545.           "mounted. Installer may crash or corrupt your system "
  546.           "in that case.)")
  547.       (help "If you do not want Installer make the changes, it will "
  548.         "create a script file containing commands which you should "
  549.         "add to the S:User-Startup file."))
  550.      ;; Do the addition
  551.      ((set startup-changed 1)
  552.       (startup
  553.        uus::section
  554.        (command uus::commands)
  555.        (prompt "Installer will modify your S:User-Startup file. "
  556.            "Following lines will be appended to it:\n\n"
  557.            uus::complete)
  558.        (help "   Installer needs to make indicated modifications to "
  559.          "your user startup file.\n"
  560.          "   You should make modifications later by hand "
  561.          "if you skip this part.")))
  562.    ;; Let user add commands
  563.    ((textfile (dest uus::file)
  564.           (append uus::complete))
  565.     (message "Installer created file " uus::file
  566.          ", which you should add to your startup file by hand. "
  567.          "The file includes following changes:\n\n"
  568.          uus::complete))))
  569.  
  570. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  571. (procedure
  572.  ask-copy-old-configuration
  573.  ;;
  574.  ;; Copy old configuration files
  575.  ;; Returns TRUE if AmiTCP does not need to be configured.
  576.  ;; The reconfiguration is forced if old AmiTCP version is not 4 or higher,
  577.  ;; since the bin/startnet must be modified.
  578.  ;;
  579.  (set
  580.   edit-change-fingerd "t:edit-change-fingerd"
  581.   old-conf-dir (tackon old-atcp-directory "db")
  582.   old-resolv.conf (tackon old-conf-dir "resolv.conf")
  583.   old-startnet (tackon old-atcp-directory "bin/startnet")
  584.   old-motd (tackon old-conf-dir "motd"))
  585.  ;;
  586.  ;; return version of the old AmiTCP detected
  587.  ;;
  588.  (procedure 
  589.   get-old-atcp-version
  590.   (if (exists (tackon old-atcp-directory "AmiTCP") (noreq))
  591.       (/ (getversion (tackon old-atcp-directory "AmiTCP")) 65536)
  592.     0))
  593.  ;;
  594.  (set old-atcp-version (get-old-atcp-version))
  595.  ;;
  596.  ;; following is called only if old version is high enough
  597.  ;;
  598.  (procedure 
  599.   copy-old-startnet 
  600.   (if (exists old-startnet)
  601.       (message "Your old \"startnet\" file cannot be used by the new "
  602.            @app-name " because the structure of it "
  603.            "has changed.  This means that you will need "
  604.            "to provide most of the configuration information after the "
  605.            "installation.")
  606. ;      ((if (>= @user-level 2)
  607. ;       (message "\nCopying file\n\n"
  608. ;            old-startnet "   \n"
  609. ;            "\nto directory \"" @default-dest "\"."))
  610. ;       (copyfiles
  611. ;    (source old-startnet)
  612. ;    (dest bin-dir)
  613. ;    (files))
  614. ;       1                ; succeeded
  615. ;       )
  616.     )
  617.   0) ; need to configure
  618.  ;;
  619.  (procedure 
  620.   copy-rest-config
  621.   (copyfiles
  622.    (prompt
  623.     "Select configuration files you want to copy from old configuration")
  624.    (help
  625.     "    You may copy your old configuration files or use untouched files "
  626.     "came with the new distribution.")
  627.    (source old-conf-dir) 
  628.    (dest conf-dir)
  629.    (files)
  630.    (confirm)
  631.    (if (AND (exists (tackon old-conf-dir "networks"))
  632.         (AND (exists (tackon old-conf-dir "ftpdir"))
  633.          (exists (tackon old-conf-dir "ftpusers"))))
  634.        (choices                ; release 4.0 or later
  635.     "AmiTCP.config"
  636.     "ch_nfstab"
  637.     "ftpdir"
  638.     "ftpusers"
  639.     "group"
  640.     "inet.access"
  641.     "inetd.conf"
  642. ;    "interfaces"
  643.     "hosts"
  644.     "networks"
  645.     "resolv.conf"
  646.     "services"
  647.     "protocols"
  648.     "passwd"
  649.     "rpc")
  650.      (if (exists (tackon old-conf-dir "inet.access"))
  651.      (choices            ; release 3.0 beta 2 or later
  652.       "AmiTCP.config"
  653.       "ch_nfstab"
  654.       "group"
  655.       "inet.access"
  656.       "inetd.conf"
  657.       "hosts"
  658.       "services"
  659.       "protocols"
  660.       "passwd"
  661.       "rpc")
  662.        (if (exists (tackon old-conf-dir "interfaces"))
  663.        (choices            ; release 3.0 beta 1 or later
  664.         "AmiTCP.config"
  665.         "group"
  666.         "inetd.conf"
  667.         "hosts"
  668.         "services"
  669.         "protocols"
  670.         "passwd"
  671.         "rpc")
  672.      (if (exists (tackon old-conf-dir "passwd"))
  673.          (choices            ; release 2.2 or later
  674.           "AmiTCP.config"
  675.           "group"
  676.           "inetd.conf"
  677.           "hosts"
  678.           "services"
  679.           "protocols"
  680.           "passwd")
  681.        (choices            ; an old release
  682.         "AmiTCP.config"
  683.         "inetd.conf"
  684.         "hosts"
  685.         "services"
  686.         "protocols")))))
  687.    (optional "nofail" "force" "askuser")))
  688.  ;;
  689.  (procedure 
  690.   copy-motd
  691.   (if (exists old-motd)
  692.       ((if (>= @user-level 2)
  693.        (message "\nCopying file\n\n"
  694.             old-motd "\n"
  695.             "(Message Of The Day)\n"
  696.             "\nto directory \"" conf-dir "\"."))
  697.        (copyfiles
  698.     (source old-motd)
  699.     (dest conf-dir)
  700.     (files)))))
  701.  ;;
  702.  ;; Following is currently not needed, since if old version is too old, we
  703.  ;; force user to reconfigure AmiTCP anyway
  704.  ;;
  705.  (procedure 
  706.   update-startnet
  707.   (set startnet-file (tackon bin-dir "startnet"))
  708.   (if (run (cat "search search \"Mount TCP:\" quiet from " startnet-file)
  709.        (safe))
  710.       ((textfile (dest startnet-file)
  711.          (include startnet-file)
  712.         (append tcp-mount "\n")
  713.         (prompt 
  714.          "\nDo you want to mount TCP: device at network startup?")
  715.         (help 
  716.          "    The " @app-name " includes a DOS handler for TCP "
  717.          "communications. This DOS handler will usually be mounted "
  718.          "at the network startup.")
  719.         (confirm))
  720.        (protect (tackon bin-dir "startnet") "+s +e"))))
  721.  (procedure
  722.   update-services
  723.   (set service-file (tackon conf-dir "services"))
  724.   (if (run (cat "search search \"amiganetfs\" quiet from " service-file)
  725.        (safe))
  726.       (;; Not found, add it 
  727.        (textfile (dest service-file)
  728.          (include service-file)
  729.          (append ";\n; Amiga specific services\n;\n"
  730.              "amiganetfs      2500/tcp\n")
  731.          (prompt 
  732.           "Do you want to add AmigaNetFS service to your "
  733.           "service database?")
  734.          (help 
  735.           "    The " @app-name " includes NetFS, network file system "
  736.           "between Amigas, by Timo Rossi. It is a TCP based protocol "
  737.           "which requires both ends of connection have same service "
  738.           "(TCP port) entries. If you already had NetFS installed "
  739.           "you probably do not want to update your service "
  740.           "database.")
  741.          (confirm)))))
  742.  (procedure
  743.   update-hosts
  744.   (set hosts-file (tackon conf-dir "hosts"))
  745.   (if (run (cat "search search \"localhost\" quiet from " hosts-file)
  746.        (safe))
  747.       (;; Not found, add it
  748.        (transcript "Adding 'localhost' entry to the db/hosts.")
  749.        (textfile (dest hosts-file)
  750.          (include hosts-file)
  751.          (append ";\n; Entry for the localhost\n;\n"
  752.              "127.0.0.1 localhost\n")
  753.          ))))
  754.  (procedure
  755.   update-inetd-conf
  756.   ;; Change fingerd to serv/in.fingerd
  757.   (set inetd-conf (tackon atcp-assign "db/inetd.conf"))
  758.   (if (run (cat "search search \"serv/in.fingerd\" quiet from " inetd-conf)
  759.        (safe))
  760.       ((textfile 
  761.     (dest edit-change-fingerd)
  762.     (append
  763.      "f b/finger    stream/\n"
  764.      "e -amitcp:bin/fingerd-amitcp:serv/in.fingerd-\n"
  765.      "m+"
  766.      "i"
  767.      "# NetFS, a networking support between Amigas"
  768.      "# Remove # from the next line to enable NetFS"
  769.      "#amiganetfs stream    tcp nowait root amitcp:serv/netfs-server"
  770.      "Z"
  771.      "w\n")
  772.     (safe))
  773.        (run (cat "c:edit from " inetd-conf " with "
  774.          edit-change-fingerd " >t:what-changed")
  775.         (confirm)
  776.         (prompt "\nUpdate \"inetd.conf\" to use the " @app-name " services?")
  777.         (help "    The fingerd service daemon is moved to directory "
  778.           "\"AmiTCP:serv\", and \"inetd.conf\" must be updated to use "
  779.           "it. Also the NetFS must be added to old configuration")))))
  780.  ;;
  781.  (procedure 
  782.   update-napsaprefs
  783.   (set old-napsaprefs
  784.        (if (exists (tackon old-atcp-directory "db/NapsaPrefs") (noreq))
  785.        (tackon old-atcp-directory "db/NapsaPrefs")
  786.      (if (exists "s:NapsaPrefs")
  787.          "s:NapsaPrefs")
  788.      ""))
  789.   (if old-napsaprefs
  790.       (;;
  791.        (copyfiles 
  792.     (source old-napsaprefs)
  793.     (dest conf-dir)
  794.     (files)
  795.     (confirm)
  796.     (prompt "\nUse your old Napsaterm preferences?")
  797.     (help  "    Installer have found an existing NapsaPrefs file "
  798.            old-napsaprefs ". You can copy it to new configuration "
  799.            "directory.")))))
  800.  (procedure 
  801.   copy-extra-binaries
  802.   "")
  803.  (transcript "Ready to copy old configuration.")
  804.  (if (askbool
  805.       (default 1)
  806.       (prompt
  807.        "\nDo you want to use settings from an earlier installation?")
  808.       (help
  809.        "    Installer have detected existing configuration "
  810.        "directory \"" old-conf-dir "\" which "
  811.        "can be used to configure the " app-name ". You can keep most "
  812.        "of your previous configuration. This is important if you have "
  813.        "installed extra applications.\n"
  814.        (if (< old-atcp-version 4)
  815.        (cat "    However, since the configuration practice of the "
  816.         @app-name " has changed since your old version, you must "
  817.         "reconfigure the " @app-name " itself. Sorry for the "
  818.         "incovenience.\n")
  819.      (cat "    Installer will copy your \"" old-startnet "\" script and "
  820.           "\"" old-resolv.conf "\" configuration.\n"))
  821.        "    Other configuration files will be then "
  822.        (if (> @user-level 1) 
  823.        "optionally")
  824.        " copied.\n"))
  825.      ((set no-reconfig (if (>= old-atcp-version 4)
  826.                (copy-old-startnet)))
  827.       (copy-rest-config)
  828.       (copy-motd)
  829.       (update-inetd-conf)
  830.       (update-hosts)
  831.       (update-services)
  832. ;;      (update-startnet)
  833.       (update-napsaprefs)
  834.       (copy-extra-binaries)
  835.       no-reconfig) ;; FALSE if AmiTCP needs to be reconfigured
  836.    0))
  837.  
  838. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  839. (procedure
  840.  install-emacstcp
  841.  ;; is GNU Emacs installed?
  842.  (if (exists "GNUEmacs:" (noreq)) ; check if GNUEmacs is installed
  843.  
  844.      ((set 
  845.        unpkt-source GNUEmacs-pkt-file
  846.        unpkt-destination "GNUEmacs:"
  847.        unpkt-sdp 1
  848.        unpkt-title-name "GNU Emacs support"
  849.        unpkt-title-not "GNU Emacs support"
  850.        )
  851.       (if (run-unpkt)
  852.       ;; Tell user what to do with .emacs
  853.       (run (cat "run " pager-cmd)
  854.            GNUEmacs-readme-file
  855.            (safe))
  856.     )
  857.       )
  858.    (message "GNU Emacs must be installed before....")))
  859.  
  860. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  861. (procedure
  862.  install-napsaterm
  863.  ;;
  864.  ;; Install Napsaterm fonts
  865.  ;;
  866.  ;; Ask for directory to install fonts.
  867.  (procedure
  868.   ask-napsa-font-dir
  869.   (askdir
  870.    (prompt "Select directory where to install Napsaterm fonts.\n")
  871.    (help "    Here you can specify location where to install "
  872.      "the Napsaterm font called `napsa'. "
  873.      "This directory should be in your font path "
  874.      "(i.e. some directory in the assign fonts:).")
  875.    (newpath)
  876.    (default "fonts:")))
  877.  
  878.  (set 
  879.   unpkt-source NapsaFonts-pkt-file
  880.   unpkt-destination (ask-napsa-font-dir)
  881.   unpkt-sdp 1
  882.   unpkt-title-name "NapsaTerm fonts"
  883.   unpkt-title-not "NapsaTerm special fonts"
  884.   )
  885.  (run-unpkt)
  886.  )
  887.  
  888. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  889. (procedure
  890.  ;;
  891.  ;; Check if user exists in the user database
  892.  ;;
  893.  ;; takes the user name in ::user-name
  894.  ;;
  895.  does-user-exist
  896.  (if (run (cat "search " (tackon conf-dir "passwd") " \"" ::user-name "|\" NONUM ")
  897.       (safe))
  898.      0
  899.    1)
  900.  )
  901.  
  902. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  903. (procedure 
  904.  ;;
  905.  ;; Add a new user into AmiTCP:db/passwd
  906.  ;;
  907.  add-new-user
  908.  (if (= anu::setdefaults 0)
  909.      (set   
  910.       anu::passwd (tackon conf-dir "passwd")
  911.       anu::passwd-new (cat anu::passwd ".new")
  912.       anu::passwd-old (cat anu::passwd ".old")
  913.       anu::tempfile "t:run-the-password"
  914.       anu::helptext (cat "    You must give an login name, user ID, group ID "
  915.              "real name and home directory for each user.\n")
  916.       anu::setdefaults 1
  917.       anu::username (cat default-user-name)
  918.       anu::UID 100
  919.       anu::GID 100
  920.       anu::realname ""
  921.       anu::homedir "HOME:"
  922.       anu::shell "shell"))
  923.  (while
  924.      ((set anu::username
  925.        (askstring
  926.         (default anu::username)
  927.         (prompt "Enter the login name of the new user:\n")
  928.         (help anu::helptext
  929.           "    The login name consists of lowercase letters a-z "
  930.           "and numbers.  Its recommended maximum length is 8 "
  931.           "characters.\n"
  932.           "    Examples of acceptable login names are `ppessi' "
  933.           "and `an345'.")))
  934.       (set ::user-name anu::username)
  935.       (if (does-user-exist)
  936.       ((message "User " anu::username " already exists.")
  937.        1))))
  938.  (set anu::UID
  939.       (asknumber
  940.        (default anu::UID)
  941.        (prompt (cat "Enter the user ID of the user " anu::username ":\n"))
  942.        (help anu::helptext
  943.          "    The user ID is a numeric unique identifier for each "
  944.          "user. "
  945.          "It is a number between 100 - 32767 for ordinary users.\n")))
  946.  (set anu::GID
  947.       (asknumber
  948.        (default anu::GID)
  949.        (prompt (cat "Enter the primary group ID of the user " 
  950.             anu::username ":\n"))
  951.        (help anu::helptext
  952.          "    The group ID is a numeric identifier of groups. "
  953.          "Each user has a primary group, which is usually 100, "
  954.          "group \"users\".\n")))
  955.  (set anu::realname
  956.       (askstring
  957.        (default anu::realname)
  958.        (prompt (cat "Enter the real name of the user " anu::username ":\n"))
  959.        (help anu::helptext
  960.          "    The real name can contain any characters except "
  961.          "comma (`,'), colon (`:') or bar (`|').")))
  962.  (set anu::homedir
  963.       (askdir
  964.        (default anu::homedir)
  965.        (prompt (cat "Give the home directory of the user " anu::username ":\n"))
  966.        (help anu::helptext
  967.          "    When user logs in, the current directory is changed to"
  968.          "her home directory.  Also, the finger information (.plan"
  969.          "and .project) is retrieved from home directory.")
  970.        (newpath)))
  971.  (set anu::shell
  972.       (askstring
  973.        (default anu::shell)
  974.        (prompt (cat "Enter the name of command interpreter for the user "
  975.             anu::username ":\n"))
  976.        (help anu::helptext
  977.          "    The command interpreter value can be either "
  978.          "`shell' or `cli'.")))
  979.  (set anu::passwd-entry 
  980.       (cat anu::username "||" anu::UID "|" anu::GID "|" 
  981.        anu::realname "|" anu::homedir "|" anu::shell "\n"))
  982.  (if (askbool 
  983.       (prompt (cat "Are you sure you want to add following user:\n\n"
  984.            "Login name: " anu::username "\n"
  985.            "User ID: " anu::UID "\n"
  986.            "Group ID: " anu::GID "\n"
  987.            "Real name: " anu::realname "\n"
  988.            "Home directory: " anu::homedir "\n"
  989.            "Shell: " anu::shell "\n"))
  990.       (choices (cat "Add " anu::username) (cat "Skip " anu::username))
  991.       (help "You can still skip creating the new user."))
  992.      ((textfile (dest anu::passwd-new)
  993.         (include anu::passwd)
  994.         (append anu::passwd-entry))
  995.       (copyfiles (source anu::passwd)
  996.          (dest conf-dir)
  997.          (newname "passwd.old")
  998.          (optional "askuser"))
  999.       (copyfiles (source anu::passwd-new)
  1000.          (dest conf-dir)
  1001.          (newname "passwd")
  1002.          (optional "askuser"))
  1003.       (textfile (dest anu::tempfile)
  1004.         (append (cat 
  1005.              "failat 5000\n"
  1006.              "avail flush >nil:\n"
  1007.              (tackon bin-dir "login") " " anu::username "\n"
  1008.              (tackon bin-dir "passwd") " " anu::username "\n"
  1009.              "endshell\n"))
  1010.         (safe))
  1011.       (run (cat "newshell from " anu::tempfile))
  1012.       (set anu::username ""
  1013.        anu::UID (+ anu::UID 1)
  1014.        anu::realname "")
  1015.       1))
  1016.  )
  1017.  
  1018. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1019. (procedure
  1020.  ;;
  1021.  ;; Add a new users into AmiTCP:db/passwd
  1022.  ;;
  1023.  add-new-users
  1024.  (while
  1025.      (askbool (prompt "\nDo you want to create a new user account?\n"
  1026.               "\nYou will be logged in with the new account "
  1027.               "immediately to set the password.")
  1028.           (choices "Proceed" "Cancel")
  1029.           (help "    You are about to add a new users into user database. "
  1030.             "Remember that the user id of each user must be unique! "
  1031.             "You will be logged in with the new user account to "
  1032.             "set the password for the new user.\n"))
  1033.    (add-new-user))
  1034.  )
  1035. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1036. (procedure 
  1037.  ;;
  1038.  ;; Ask for the default user
  1039.  ;;
  1040.  ask-default-user
  1041.  (if (= adu::setdefaults 0)
  1042.      (set   
  1043.       adu::setdefaults 1
  1044.       default-user-name ""))
  1045.  (while (= default-user-name "")
  1046.    (while
  1047.        ((set default-user-name
  1048.          (askstring
  1049.           (default default-user-name)
  1050.           (prompt "Enter the default user name\n")
  1051.           (help "    The AmiTCP/IP can handle currently only one user "
  1052.             "at a time.  The default user is selected with `login' "
  1053.             "command by system startup script. ")))
  1054.     (set ::user-name default-user-name)
  1055.     (if (NOT (does-user-exist))
  1056.       (NOT (add-new-user))))))
  1057.  )
  1058.  
  1059. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1060. (procedure
  1061.  ;;
  1062.  ;; Install passwd and group databases
  1063.  ;;
  1064.  install-user-databases
  1065.  (transcript "Installing user databases")
  1066.  (procedure get-mufs-version
  1067.         (set mufs-vernum (getversion "multiuser.library" (resident)))
  1068.         (set mufs-ver (/ mufs-vernum 65536))
  1069.         (set mufs-rev (- mufs-vernum (* ver 65536))))
  1070.  (procedure passwd-create
  1071.         (copyfiles
  1072.          (prompt "Copying " passwd-source " to AmiTCP:db/passwd.")
  1073.          (source passwd-source)
  1074.          (dest conf-dir)
  1075.          (newname "passwd")
  1076.          (optional "nofail")))
  1077.  (procedure group-create
  1078.         (copyfiles
  1079.          (prompt "Copying " group-source " to AmiTCP:db/group.")
  1080.          (source group-source)
  1081.          (dest conf-dir)
  1082.          (newname "group")
  1083.          (optional "nofail")))
  1084.        
  1085.  (set passwd-source (tackon conf-dir "passwd-example"))
  1086.  (set group-source (tackon conf-dir "group-example"))
  1087.  (if (>= @user-level 2)
  1088.      (message 
  1089.       "\n"
  1090.       "Copying user database from file"
  1091.       "\n\n\"" passwd-source "\"\n\n"
  1092.       "and group database from file"
  1093.       "\n\n\"" group-source "\"\n\n"))
  1094.  (passwd-create)
  1095.  (group-create)
  1096.  )
  1097.  
  1098. (procedure 
  1099.  set-must-reboot
  1100.  (if (<> (getversion "netinfo.device" (resident)) 0)
  1101.      ((set netinfo-temp-file "t:netinfo-expunge-script")
  1102.       (textfile (dest netinfo-temp-file)
  1103.         (append (cat 
  1104.              "failat 5000\n"
  1105.              "avail flush >nil:\n"
  1106.              "avail flush >nil:\n"))
  1107.         (safe))
  1108.       (execute netinfo-temp-file)))
  1109.  (if (<> (getversion "netinfo.device" (resident)) 0)
  1110.      ((set must-reboot-after-install 1)
  1111.       (message "You seem to have some parts of an old " @app-name 
  1112.            " installation running.  Because of this the user "
  1113.            "database updating will have no effect before you reboot "
  1114.            "your Amiga.\n\n"
  1115.            "For this reason you _must_ reboot after the installation "
  1116.            "and before the \"Config_AmiTCP\" is run."))))
  1117.  
  1118. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1119. ;;;
  1120. ;;; Ask which parts to install
  1121. ;;;
  1122. ;;; on return following variables will have boolean values:
  1123. ;;;
  1124. ;;;  do-install-amitcp
  1125. ;;;  do-install-drivers
  1126. ;;;  do-install-emacstcp
  1127. ;;;  do-install-napsafonts
  1128. ;;;
  1129. (procedure
  1130.  ask-install-options
  1131.  (set 
  1132.   install-options-bitmap
  1133.   (askoptions
  1134.    (prompt "Select parts to install:\n\n"
  1135.        "See the help for explanation on each item.")
  1136.    (choices "AmiTCP/IP"
  1137.         "Updated Sana-II network drivers"
  1138.         "GNU Emacs support"
  1139.         "NapsaTerm fonts"
  1140.         "AmiTCP/IP Software Development Kit"
  1141.         )
  1142.    (default (if (exists "GNUEmacs:" (noreq))
  1143.         %00111
  1144.           %00011))
  1145.    (help "    AmiTCP/IP: "
  1146.      "The AmiTCP/IP itself. This includes binaries, help files and "
  1147.      "example configuration files.\n"
  1148.      "    Updated Sana-II network drivers: "
  1149.      "If this option is checked, the Sana-II drivers in Devs:Networks "
  1150.      "will be updated. You will be asked for confirmation for each driver.\n"
  1151.      "    GNU Emacs support: "
  1152.      "AmiTCP/IP provides an Emacs extension, which makes "
  1153.      "it possible to run networking programs with it. To enable "
  1154.      "this feature some files need to be installed "
  1155.      "in to directories under \"GNUEmacs:\". "
  1156.      "NOTE: This option has effect only if GNU Emacs is currently installed.\n"
  1157.      "    NapsaTerm fonts: "
  1158.      "NapsaTerm has special fonts, that are sized 6×11 pixels and contain "
  1159.      "some special VT102 characters. They are suitable for interlaced "
  1160.      "screens. If you have normal NTSC or PAL screen, it might be better "
  1161.      "to not install these fonts but use Topaz/8 instead.\n"
  1162.      "    AmiTCP/IP Software Development Kit (SDK): "
  1163.      "AmiTCP/IP programmer's include files and libraries. This is offered "
  1164.      "as a free bonus in this release. The SDK currently supports only "
  1165.      "SAS/C, but many if it's files can be used with other compilers as "
  1166.      "well.\n"
  1167.      ))
  1168.   do-install-amitcp (in install-options-bitmap 0)
  1169.   do-install-drivers (in install-options-bitmap 1)
  1170.   do-install-emacstcp (in install-options-bitmap 2)
  1171.   do-install-napsafonts (in install-options-bitmap 3)
  1172.   do-install-sdk (in install-options-bitmap 4)
  1173.   ))
  1174.  
  1175.  
  1176. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1177. ;;;
  1178. ;;; Install AmiTCP/IP
  1179. ;;;
  1180. (procedure 
  1181.  install-amitcp
  1182.  (select-destination-directory)
  1183.  (if (copy-files-to-destination) ; copy AmiTCP/IP files
  1184.      (
  1185.       ;; update user-startup
  1186.       (set uus::commands (cat "assign " atcp-assign " " @default-dest "\n"
  1187.                   "path " bin-dir " add\n"
  1188.                   apipe-mount)
  1189.        uus::section @app-name
  1190.        uus::file (tackon atcp-assign "addition-to-user-startup"))
  1191.       (update-user-startup))
  1192.    ))
  1193.  
  1194. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1195. (procedure
  1196.  install-sdk
  1197.  (set sdk-dest-dir
  1198.       (askdir
  1199.        (prompt "Select the directory in which the SDK should be placed:")
  1200.        (help "    The SDK subdirectories will be placed on the directory you "
  1201.          "select.\n")         
  1202.        (newpath)
  1203.        (default @default-dest)))
  1204.  (if (NOT (= 2 (exists (sdk-dest-dir))))
  1205.      (makedir sdk-dest-dir (infos)))
  1206.  
  1207.  ((set 
  1208.    unpkt-source SDK-pkt-file
  1209.    unpkt-destination sdk-dest-dir
  1210.    unpkt-sdp 1
  1211.    unpkt-title-name "Software Development Kit"
  1212.    unpkt-title-not "The SDK"
  1213.    )
  1214.   (if (run-unpkt)
  1215.       (
  1216.        ;; add assigns to user-startup
  1217.        (set uus::commands
  1218.         (cat "assign netinclude:" (tackon sdk-dest-dir "netinclude") "\n"
  1219.          "assign netlib:" (tackon sdk-dest-dir "netlib") "\n"
  1220.          (if (<> (expandpath atcp-assign)
  1221.              (expandpath sdk-dest-dir))
  1222.              (cat "path " (tackon sdk-dest-dir "bin") " add\n")
  1223.            ""))
  1224.         uus::section (cat @app-name " SDK")
  1225.         uus::file (tackon atcp-assign "addition-to-user-startup-SDK"))
  1226.        (update-user-startup)
  1227.        ;; Show the SDK readme file
  1228.        (run (cat "run " pager-cmd) SDK-readme-file (safe)))
  1229.     )))
  1230.  
  1231. ;;; copy "UnPkt" to RAM: if available
  1232. ;;
  1233. ;; If UnPkt is not found, then we are not started from the installation disk
  1234. ;;
  1235. ;;;
  1236. (procedure
  1237.  set-unpkt-cmd
  1238.  (set unpkt-cmd
  1239.       (if (exists UnPkt-file)
  1240.       ((copyfiles
  1241.         (prompt "Copying packet dearchiver to RAM:")
  1242.         (source UnPkt-file)
  1243.         (dest   "RAM:")
  1244.         (safe)
  1245.         (optional "nofail"))
  1246.        "RAM:UnPkt")
  1247.     "")))
  1248.  
  1249. ;;;;;
  1250. ;
  1251. ; Launch Config_AmiTCP
  1252. ;
  1253. (procedure
  1254.   run-config-amitcp
  1255.   (set start-config-script "t:start-config-script")
  1256.   (textfile 
  1257.    (dest start-config-script)
  1258.    (append
  1259.     ".key foo\n.bra {\n.ket }\n\n"
  1260.     "cd " atcp-assign "\n"
  1261.     "Stack 20000 ; Installer needs this\n"
  1262.     (tackon bin-dir "Installer")
  1263.     " SCRIPT Config_AmiTCP APPNAME AmiTCP/IP MINUSER AVERAGE\n"
  1264.     )
  1265.    (safe))
  1266.   (protect start-config-script "+s +e")
  1267.   (if (askbool
  1268.        (prompt "\nStart \"Config_AmiTCP\" to configure the just "
  1269.            "installed " @app-name "?")
  1270.        (help @app-name " should be configured after the installation. "
  1271.          "If you do not want to do the configuration now, you must "
  1272.          "do it later by starting the \"Config_AmiTCP\" from the "
  1273.          "WorkBench icon.\n"))
  1274.       (execute start-config-script)))
  1275.  
  1276. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1277. ;;;
  1278. ;;; Installatation sequence
  1279. ;;;
  1280.  
  1281. ;
  1282. ; Initialize "global" variables to default values (not complete)
  1283. ;
  1284. (set
  1285.  startup-changed 0
  1286.  must-reboot-after-install 0
  1287.  )
  1288.  
  1289. (complete 00) (transcript "On making " app-name ".")
  1290. (complete 01) (check-user-level)
  1291. (complete 02) (check-system-version)
  1292. (complete 03) (check-available-memory)
  1293. (complete 04) (check-old-assign)
  1294. (complete 05) (check-cpu-type)
  1295.  
  1296. ; askdisk for the install-disk1-name?? maybe later...
  1297.  
  1298. ; show the README-FIRST file if it exists
  1299. (if (exists README-FIRST-file)
  1300.     ((run (cat "run " pager-cmd) README-FIRST-file (safe))
  1301.      (message "    Please read the shown \"README.FIRST\" file carefully "
  1302.           "before continuing the installation.")))
  1303.  
  1304. ;
  1305. ; Check if started from the installation disk
  1306. ;
  1307. ;(if (= (expandpath source-dir) install-disk1-name)
  1308. ;    (
  1309.      (set-unpkt-cmd)
  1310.      (if (= unpkt-cmd "")
  1311.      (abort "    UnPkt command not present on the installation disk!"))
  1312.  
  1313.      (complete 08) (ask-accept-license)         ; ask if user accepts the license
  1314.      (complete 10) (ask-install-options)
  1315.      (complete 15) (if do-install-amitcp (install-amitcp))
  1316.      (complete 30) (if do-install-sdk (install-sdk))
  1317.      (complete 25) (if do-install-emacstcp (install-emacstcp))
  1318.      (complete 30) (if do-install-napsafonts (install-napsaterm))
  1319.      (complete 35) (if do-install-drivers (update-devices))
  1320.      (if do-install-amitcp    ; Ask if old configuration should be copied
  1321.      (
  1322.       (set-must-reboot)
  1323.       (set old-conf-used 
  1324.            (if old-atcp-directory
  1325.            (if (exists (tackon old-atcp-directory "bin/startnet") 
  1326.                    (noreq))
  1327.                ((complete 40)
  1328.             (ask-copy-old-configuration)))))
  1329.       ;;
  1330.       ;; Install user databases if not copied from an old configuration
  1331.       ;;
  1332.       (if (exists (tackon conf-dir "passwd"))
  1333.           (transcript "There is already a user database.")
  1334.         ((complete 70)
  1335.          (install-user-databases))) ; install passwd/group
  1336.       ;;
  1337.       ;; Configure AmiTCP/IP is necessary
  1338.       ;;
  1339.       (complete 90)
  1340.       (if (AND (NOT must-reboot-after-install) (NOT old-conf-used))
  1341.           ;;
  1342.           ;; Spawn the installer on the Config_AmiTCP with 
  1343.           ;; correct options
  1344.           (run-config-amitcp)
  1345.           ;(configure-amitcp)
  1346.         )
  1347.       ))
  1348.      ;; show something
  1349.      (foreach atcp-assign "#?.readme"
  1350.           (run (cat "run " pager-cmd) (tackon atcp-assign @each-name)
  1351.            (safe)))
  1352. ;     )
  1353. ;  (    ;; Not started from the installation directory
  1354. ;   ;; Started from an unknown directory
  1355. ;   (abort "    The installation was started from an invalid directory.\n"
  1356. ;      "    If you want to re-install some parts of the " @app-name
  1357. ;      " installation, "
  1358. ;      "please start the \"Install_AmiTCP\" from the installation disk.")
  1359. ;   )
  1360. ;  )
  1361.  
  1362. ;;; All done!
  1363. (complete 100)
  1364. (exit (if startup-changed 
  1365.       (cat "You should reboot your Amiga to enable the changes made "
  1366.            "to system startup files.")
  1367.     (cat "You must add the contents of the file(s) \"" 
  1368.          "addition-to-user-startup#?\" to your S:User-Startup and "
  1369.          "reboot before you can use " @app-name ".\n"))
  1370.       (if must-reboot-after-install
  1371.       (cat "\nYou MUST reboot before configuring " @app-name ". Start "
  1372.            "\"Config_AmiTCP\" from WorkBench after the reboot "
  1373.            "to configure your new " @app-name " installation.\n")))
  1374.  
  1375. ; EOF
  1376.